
(defun hello-world (name)
  "say hello"
  (message "hello,%s" name)
  )


(hello-world "zhangsan")


(setq foo "I'm foo!")
(message foo)



(defun ca1 (r)
  (let ((pi 3.14)
	area)
    (setq area (* pi r r))
    (message "ca1 area:%.2f" area)
    )
  )
(ca1 3)



(defun ca (r)
  (let* ((pi 3.14)
	 (area (* pi r r)))
    (message "xxxxx area:%.2f" area)
    )
  )

(ca 2)

(setq foo (lambda (name)
	    (message "hello,%s!" name)))


(funcall foo "xxoo")


;; 顺序执行
(progn
  (setq fooo 3)
  (message "%d的平方是%d" fooo (* fooo fooo))
  )


(defun my-max (a b)
  (if (> a b)
      a b)
  )

(my-max 10 2)

(defun fib (n)
  (cond ((= n 0) 0)
	((= n 1) 1)
	(t (+ (fib (- n 1))
	      (fib (- n 2))))
	)
  )

(fib 10)


(defun factorial (n)
  (let ((res 1))
    (while (> n 1)
      (setq res (* res n)
	   n (- n 1)))
   res)
  )

(factorial 10)



(defun hello-world (&optional name)
  (or name (setq name "daidai"))
  (message "Hello,%s " name)
  )

(hello-world)
(hello-world "xx")


(defun square-number-p (n)
  (and (>= n 0)
       (= (/ n (sqrt n) (sqrt n))))
  )

(square-number-p -1)
(square-number-p 5)



(integerp 1.)

(floatp 1.)
(floatp -0.0e+NaN)
(numberp 1.)


